home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 25
/
Cream of the Crop 25.iso
/
program
/
vol16n09.zip
/
MFCTIP.ZIP
/
PGCNT.TXT
< prev
Wrap
Text File
|
1997-04-14
|
916b
|
31 lines
BOOL CAccelView::OnPreparePrinting (CPrintInfo* pInfo)
{
//
// Compute the page count.
//
if (!pInfo->m_bPreview) {
CPrintInfo pi;
if (AfxGetApp ()->GetPrinterDeviceDefaults (&pi.m_pPD->m_pd)) {
HDC hDC = pi.m_pPD->m_pd.hDC;
if (hDC == NULL)
hDC = pi.m_pPD->CreatePrinterDC ();
if (hDC != NULL) {
CDC dc;
dc.Attach (hDC);
int nWidth = dc.GetDeviceCaps (HORZRES); // Page width
int nHeight = dc.GetDeviceCaps (VERTRES); // Page height
// TODO: Compute nPageCount from nWidth and nHeight
pInfo->SetMaxPage (nPageCount);
::DeleteDC (dc.Detach ());
}
}
}
//
// Display the Print dialog and create a printer DC.
//
return DoPreparePrinting (pInfo);
}